//
//  VOHButton.m
//  VoiceOfHeart
//
//  Created by 吉龙 on 16/8/12.
//  Copyright © 2016年 吉龙. All rights reserved.
//

#import "VOHButton.h"

@implementation VOHButton

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}


+(instancetype)creatButtonWithFrame:(CGRect)frame Title:(NSString *)title HighLightImageName:(NSString *)highImageName ImageName:(NSString *)imageName{
    VOHButton *button = [VOHButton buttonWithType:UIButtonTypeCustom];
    
    [button setTitle:title forState:UIControlStateNormal];
    
    [button setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    
    [button setBackgroundImage:[UIImage imageNamed:highImageName] forState:UIControlStateHighlighted];
    button.frame = frame;
    
    
    return button;
}


-(void)buttonAction:(VOHButton *)sender{
    if (_block) {
        _block(sender);
    }
}


@end
